package cn.stylefeng.guns.modular.cb.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.cb.entity.*;
import cn.stylefeng.guns.modular.cb.model.params.*;
import cn.stylefeng.guns.modular.cb.service.*;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 控制器
 * 投递简历
 * @author ss
 * @Date 2021-01-19 19:43:23
 */
@Controller
@RequestMapping("/cbResumeDelivery")
public class CbResumeDeliveryController extends BaseController {

    private static Logger logger = LoggerFactory.getLogger(CbResumeDeliveryController.class);

    private String PREFIX = "/cb/cbResumeDelivery";

    @Autowired
    private CbResumeDeliveryService cbResumeDeliveryService;

    /**
     * 跳转到主页面
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/cbResumeDelivery.html";
    }

    /**
     * 新增页面
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/cbResumeDelivery_add.html";
    }

    /**
     * 编辑页面
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/cbResumeDelivery_edit.html";
    }

    /**
     * 新增接口
     * 简历投递
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(CbResumeDeliveryParam cbResumeDeliveryParam) {
        this.cbResumeDeliveryService.addResumeDelivery(cbResumeDeliveryParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(CbResumeDeliveryParam cbResumeDeliveryParam) {
        this.cbResumeDeliveryService.update(cbResumeDeliveryParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(CbResumeDeliveryParam cbResumeDeliveryParam) {
        this.cbResumeDeliveryService.delete(cbResumeDeliveryParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author ss
     * @Date 2021-01-19
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(CbResumeDeliveryParam cbResumeDeliveryParam) {
        CbResumeDelivery detail = this.cbResumeDeliveryService.getById(cbResumeDeliveryParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author ss
     * @Date 2021-01-19
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(CbResumeDeliveryParam cbResumeDeliveryParam) {
        return this.cbResumeDeliveryService.findPageBySpec(cbResumeDeliveryParam);
    }

    /**
     * 职位投递列表
     * @author ss
     * @Date 2021-01-19
     */
    @ResponseBody
    @RequestMapping("/deliver_list")
    public LayuiPageInfo findDeliverList(CbResumeDeliveryParam cbResumeDeliveryParam) {
        return this.cbResumeDeliveryService.findDeliverList(cbResumeDeliveryParam.getPositionId());
    }

}


